﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using WPFExcelReport.Helpers;
namespace WPFExcelReport
{
    public partial class TCMVR05
    {  

        public TCMVR05()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VVRPOS();
            DataContext = MV;
            InitializeComponent();
        } 
        DataRow dwPay = null;     
        private void ManualPayment(object sender, RoutedEventArgs e)
        {

            if (dwMaster == null)
            {
                MessageBox.Show("请选择一行发票");
                return;
            }
            if (dwMaster == null)
                return;
            if (!IsMPay)
            {
                SVALUE = 0;
                IsMPay = true;
                return;
            }
            ManulPaid(dwMaster, true, false, false);//   
            IsMPay = false;
        }

        private void OpenCMCommand(object sender, RoutedEventArgs e)
        {
            dwData = TBMain.NewRow();
            dwData["VRPMANDANT"] = app.Mandant;
            dwData["VRPSTATIST"] = "K"; 
            dwData["VRPVLIEFNR"] = " AND VRPVLIEFNR LIKE '" + ART.Trim() + "%'";
            dwData["VRPAUFKRS"] = " AND VRPAUFKRS LIKE '" + KRS + "%'";
            dwData["VRPAUFLFD"] = " AND VRPAUFLFD LIKE '" + LFD + "%'";
            if (!IsPaid)
            {
                dwData["VRPFILLER4"] = " AND VRPZOLLTNR LIKE '8:%' AND VRPBONKZ='N' AND VRPARTKUNDNR='00000000'";
            }
            else
            {
                dwData["VRPFILLER4"] = " AND VRPZOLLTNR LIKE '8:%'  AND VRPARTKUNDNR='00000000'";
            }
            SResult = TMV.QVRP10(dwData);
            MergeData(SResult, true, true);
            base.QueryCommand(sender, e);
        }
    }
}